import {
		useStore
	} from '@/store/index.js'
	
export default {
	data() {
		return {

		}
	},
	onLoad: function() {
		wx.showShareMenu({
			withShareTicket: true,
			menus: ["shareAppMessage", "shareTimeline"]
		})
	},
	onShareAppMessage(res) {
		let that = this;
		let imageUrl = that.shareUrl || '';
		var uid='';
		try{
			var uid = useStore().userInfo.id ;
		}
		catch{}
        // var uid = uni.getStorageSync("uid");
        var parm = "?uid="+uid;
        for(var key in that.$scope.options){
            // console.log(key,that.$scope.options[key])
            parm+="&"+key+"="+that.$scope.options[key];
        }
        let path = `/` + that.$scope.route + parm;
        // console.log(that.$scope.options);
        console.log(path);
		if (res.from === 'button') {
		//这块需要传参，不然链接地址进去获取不到数据
			return {
				title: '拼拼事',
				path: path,
				imageUrl: imageUrl
			};
		}
		if (res.from === 'menu') {
			return {
				title: '拼拼事',
				path: path,//'/pages/carWash/carWash',
				imageUrl: imageUrl
			};
		}
	},
	// 分享到朋友圈
	onShareTimeline(res) {
		let that = this;
        console.log(that.$scope.options);
		var uid='';
		try{
			var uid = useStore().userInfo.id ;
		}
		catch{}
        // var uid = uni.getStorageSync("uid");
		return {
			title: '拼拼事',
			path: '/pages/index/index?&uid='+uid,
			// imageUrl: 'https://cdn.uviewui.com/uview/swiper/1.jpg'
		};
	},
	methods: {

	}
}

